﻿using RayDen.Library.Entity;
using RayDen.Library.Entity.Interface;
using RayDen.RayEngine;

namespace RayDen.MegaRay
{
    public class ConfigurationManager : IParameterBag
    {

        protected IParameterBag Config;

        public ConfigurationManager()
        {
            this.Config = new ConfigurableEntity(GlobalConfiguration.Instance);            
        }

        public TValue Get<TValue>(string name)
        {
            return this.Config.Get<TValue>(name);
        }

        public TValue Get<TValue>(string name, TValue @default)
        {
            return this.Config.Get<TValue>(name, @default);
        }

        public System.Collections.Generic.Dictionary<string, object> GetItems()
        {
            return this.Config.GetItems();
        }

        public void Merge(IParameterBag bag)
        {
            this.Config.Merge(bag);
        }

        public System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<string, object>> GetEnumerator()
        {
            return this.Config.GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return this.Config.GetEnumerator();
        }
    }
}